// map(key不可重复)和multimap(key可重复)
// 会自动升序排序
// map中元素为pair<key, value>
#include <iostream>
#include <map>
using namespace std;
class MyCompare
{
public:
    bool operator()(int a, int b) const
    {
        return a > b;
    }
};
void test1()
{
    map<int, int, MyCompare> m1;
    for (int i = 1; i < 6; ++i)
    {
        m1.insert(pair<int, int>(i, 10*i));
        m1.insert(make_pair(10*i, 100*i));
    }
    for (map<int, int>::iterator it = m1.begin(); it != m1.end(); ++it)
    {
        cout << it->first << " " << it->second << endl;
    }
    map<int, int>::iterator it1 = m1.find(2);
    if (it1 != m1.end())
    {
        cout << "找到了" << endl;
    }
    else 
    {
        cout << "未找到" << endl;
    }
    // 对于map,count结果非零即一
    cout << m1.count(3) << endl;
    cout << m1[3] << endl;

}
int main(void)
{
    test1();

    return 0;
}